# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-embark
pkgver=1.0_git20240327
_gitrev=d3c9d1b4c890cf365846cc2b418f37341999e79f
pkgrel=0
_pkgreal=embark
pkgdesc="Conveniently act on minibuffer completions"
url="https://github.com/oantolin/embark"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-compat
	"
makedepends="
	emacs-avy
	emacs-consult
	emacs-nox
	"
subpackages="
	emacs-avy-embark-collect
	emacs-embark-consult
	"
source="https://github.com/oantolin/embark/archive/$_gitrev/emacs-embark-$_gitrev.tar.gz"
builddir="$srcdir/$_pkgreal-$_gitrev"
options="!check" # no tests provided

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq byte-compile-error-on-warn t)' \
		-f batch-byte-compile \
		./*.el
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal/

	cd "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

collect() {
	pkgdesc="Use Avy to jump to Embark Collect entries"
	depends="$pkgname=$pkgver-r$pkgrel emacs-avy"
	install_if="$pkgname=$pkgver-r$pkgrel emacs-avy"

	amove usr/share/emacs/site-lisp/$_pkgreal/avy-embark-collect.el*
}

consult() {
	pkgdesc="Consult integration for Embark"
	depends="$pkgname=$pkgver-r$pkgrel emacs-consult"
	install_if="$pkgname=$pkgver-r$pkgrel emacs-consult"

	amove usr/share/emacs/site-lisp/$_pkgreal/embark-consult.el*
}

sha512sums="
bfa06e7b7ab95bc52b27e727b397373423c832bd1ff602b0e9d7a9ac85d8a38c6007604c5d3a68ea5e7f4611471e563a91f3780ff514634654a4229feac1c657  emacs-embark-d3c9d1b4c890cf365846cc2b418f37341999e79f.tar.gz
"
